#include <bits/stdc++.h>
using namespace std;

inline int read(){
	int x = 0, f = 1;
	char c = getchar();
	for(; c < '0' || c > '9'; c = getchar()) if(c == '-') f = -1;
	for(; c >= '0' && c <= '9'; c = getchar()) x = x * 10 + c - '0';
	return f * x;
}

const int N = 1e5 + 9;
int a[N];
bool vis1[N], vis2[N];
int n, cnt1, cnt2, ans;

int main(){
	freopen("duel.in", "r", stdin);
	freopen("duel.out", "w", stdout);
	n = read();
	bool f = 1;
	for(int i = 1; i <= n; i++){
		a[i] = read();
		cnt1 = cnt1 + (a[i] == 1);
		cnt2 = cnt2 + (a[i] == 2);
		if(a[i] != 1 && a[i] != 2) f = 0;
	}
	sort(a + 1, a + 1 + n);
	if(f) {cout << n - min(cnt1, cnt2); return 0;}
	for(int i = 1; i <= n; i++){
		if(vis2[i]) continue;
		for(int j = i - 1; j >= 1; j--){
			if(a[j] < a[i] && !vis1[j]){
				vis1[j] = 1;
				vis2[i] = 1;
				break;
			} 
		}
	}
	for(int i = 1; i <= n; i++) if(!vis1[i]) ans++;
	cout << ans;
	return 0;
}
//freopen
//filename
